<template>
  <j-modal
    :title="title"
    :width="1200"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel">
    <table-dayin-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/>
  </j-modal>
</template>

<script>

  import TableDayinForm from './TableDayinForm'
  import { httpAction,getAction } from '@/api/manage'

  export default {
    name: 'TableDayinModal',
    components: {
      TableDayinForm
    },
    data() {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false,
        props: ['formData'],
        url:{
          queryById: "/dayin/tableDayin/queryById",//填写表单的queryById请求地址
        },
      }
    },
    methods:{
      created () {
        var params = {id:this.formData.dataId};//查询条件
        getAction(this.url.queryById,params).then((res)=>{
          if(res.success){
            this.edit (res.result);
          }
        })
      },
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit (record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.handleOk();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>

<style scoped>
</style>